﻿
using MediatR;
using Microsoft.IdentityModel.Tokens;
using System.Runtime.InteropServices;
using Traceability.Commont.Domains.BatchManagementFiles;
using Traceability.Commont.DTOs.CommontFiles;
using Traceability.Commont.Infrastructures.Interfaces;

namespace U.Enterprise.Api.Applications.WhitestripWeighing
{
    public class WhiteStripWeighingDellHandler : IRequestHandler<WhiteStripWeighingDelCommond, Resqults>
    {

        private readonly IBateRepository<WhiteNotes> _WhiteNote;

        public WhiteStripWeighingDellHandler(IBateRepository<WhiteNotes> whiteNote
            )
        {
            _WhiteNote = whiteNote;
        }

        public async Task<Resqults> Handle(WhiteStripWeighingDelCommond request, CancellationToken cancellationToken)
        {
           var list=new Resqults() { Code=0};

            var query=_WhiteNote.GetAll().Where(x=>x.WhiteNoteid==request.WihteWeightid).FirstOrDefault();
            if (query!=null)
            {
                query.isyes = 1;
             var hk= _WhiteNote.Update(query);

                list.Code = 1;
            }
            return list;





        }
    }
}
